package com.hupu.jrs.ui.thread.list

import android.content.Context
import android.content.Intent

import com.gzsll.hupu.R
import com.gzsll.hupu.injector.HasComponent
import com.gzsll.hupu.ui.BaseSwipeBackActivity

import butterknife.ButterKnife

/**
 * Created by sll on 2016/3/11.
 */
class ThreadListActivity : BaseSwipeBackActivity(), HasComponent<ThreadListComponent> {

    var component: ThreadListComponent? = null
        private set

    protected val isApplyStatusBarTranslucency: Boolean
        get() = false

    protected val isApplyStatusBarColor: Boolean
        get() = true

    fun initContentView(): Int {
        return R.layout.base_content_empty
    }

    fun initInjector() {
        val fid = getIntent().getStringExtra("fid")
        component = DaggerThreadListComponent.builder()
                .applicationComponent(getApplicationComponent())
                .activityModule(getActivityModule())
                .threadListModule(ThreadListModule(fid))
                .build()
    }

    fun initUiAndListener() {
        ButterKnife.bind(this)
        getFragmentManager().beginTransaction()
                .replace(R.id.content, ThreadListFragment())
                .commit()
    }

    companion object {

        fun startActivity(mContext: Context, fid: String) {
            val intent = Intent(mContext, ThreadListActivity::class.java)
            intent.putExtra("fid", fid)
            mContext.startActivity(intent)
        }
    }
}
